package a.j;

import a.c.e;
import a.c.z;
import a.d.w;
import a.e.b.b.fb;
import a.e.b.c.eb;
import a.e.b.c.v;
import a.f.hc;
import a.f.xc;
import a.f.yc;
import a.f.zc;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;

public class ce
  implements yc
{
  public static final byte a = 0;
  public static final byte b = 1;
  public static final byte c = 2;
  public static final byte d = 3;
  public static final byte e = 4;
  private static final byte[] f = { 0, 1, 2, 3, 4 };
  private final double g;
  private final boolean h;
  static Class i;
  static Class j;
  static Class k;
  public static int l;
  
  public ce(double paramDouble)
  {
    this(paramDouble, true);
  }
  
  public ce(double paramDouble, boolean paramBoolean)
  {
    this.h = paramBoolean;
    this.g = paramDouble;
  }
  
  public double b()
  {
    return this.g;
  }
  
  public boolean c()
  {
    return this.h;
  }
  
  public Object a(a.d.o paramo, zc paramzc)
  {
    if (!ld.E) {
      if (a(paramo)) {
        throw new IllegalArgumentException("Invalid label bounds: " + paramo);
      }
    }
    w localw = paramo.l();
    a.d.s locals = paramo.f();
    return a(new a.d.t(localw.a() - locals.b() * 0.5D, localw.b() - locals.c() * 0.5D, locals.b(), locals.c()), paramzc);
  }
  
  private Object a(a.d.t paramt, zc paramzc)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    a_ locala_ = null;
    if ((bool2) || ((paramzc instanceof ld)))
    {
      ld localld = (ld)paramzc;
      if (localld.y() > 0)
      {
        double d1 = (1.0D / 0.0D);
        w localw1 = paramt.f();
        Iterator localIterator = localld.z();
        label81:
        do
        {
          break label81;
          jd localjd;
          int m;
          byte b1;
          double d2;
          do
          {
            do
            {
              if (!localIterator.hasNext()) {
                break;
              }
              localjd = (jd)localIterator.next();
              m = 0;
            } while (m >= f.length);
            b1 = f[m];
            w localw2 = a(paramt, localjd, b1);
            d2 = w.a(localw1, localw2);
            if (bool2) {
              break;
            }
            if ((!bool2) && (bool1)) {
              return locala_;
            }
          } while (bool1);
          if (d1 > d2)
          {
            d1 = d2;
            locala_ = new a_(localld.e(localjd), b1);
          }
          m++;
        } while (!bool1);
      }
    }
    if ((!bool2) && (!bool2)) {
      if (locala_ == null) {
        return a();
      }
    }
    return locala_;
  }
  
  public Object a()
  {
    return new a_(null, (byte)0);
  }
  
  public a.d.o a(a.d.s params, zc paramzc, Object paramObject)
  {
    w localw = b(params, paramzc, paramObject);
    return new a.d.o(new w(localw.a(), localw.b() + params.c()), params);
  }
  
  private w b(a.d.s params, zc paramzc, Object paramObject)
  {
    if ((ld.E) || ((paramzc instanceof ld)))
    {
      a_ locala_ = c(paramObject);
      jd localjd = a((ld)paramzc, paramObject);
      if (localjd != null) {
        return a(params, localjd, locala_.c);
      }
    }
    return a(params, paramzc);
  }
  
  private w a(a.d.s params, zc paramzc)
  {
    return new w(paramzc.a() + (paramzc.c() - params.a) * 0.5D, paramzc.b() + (paramzc.d() - params.b) * 0.5D);
  }
  
  public z a(xc paramxc, zc paramzc)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    z localz = new z();
    Object localObject1;
    if (!bool2)
    {
      if ((paramzc instanceof ld))
      {
        localObject1 = (ld)paramzc;
        Iterator localIterator = a(paramxc, (ld)localObject1);
        if (bool2) {
          break label203;
        }
        if (localIterator.hasNext())
        {
          a.d.t localt = paramxc.c();
          do
          {
            jd localjd;
            Object localObject2;
            int m;
            while (m >= f.length)
            {
              if (!localIterator.hasNext()) {
                break;
              }
              localjd = (jd)localIterator.next();
              localObject2 = ((ld)localObject1).e(localjd);
              m = 0;
            }
            if (bool2) {
              break label242;
            }
            localz.add(new hc(a(localt, localjd, f[m]), localt, new a_(localObject2, f[m]), paramxc, true));
            m++;
            if (bool2) {
              break label203;
            }
            if (bool1) {
              return localz;
            }
            if (bool2) {
              break label203;
            }
          } while ((!bool1) && (!bool1));
        }
      }
      if ((bool2) || (bool2)) {
        break label242;
      }
    }
    if (localz.isEmpty())
    {
      label203:
      localObject1 = paramxc.c();
      localz.add(new hc(a((a.d.s)localObject1, paramzc), (a.d.s)localObject1, a(), paramxc, true));
    }
    label242:
    return localz;
  }
  
  private Iterator a(xc paramxc, ld paramld)
  {
    boolean bool = ld.E;
    if ((bool) || (paramld.y() > 0)) {
      if ((bool) || (c()))
      {
        if (a(paramxc.e()))
        {
          jd localjd = a(paramld, paramxc.e());
          if (localjd != null)
          {
            ArrayList localArrayList = new ArrayList(1);
            localArrayList.add(localjd);
            return localArrayList.iterator();
          }
        }
      }
      else {
        return paramld.z();
      }
    }
    return Collections.EMPTY_LIST.iterator();
  }
  
  private w a(a.d.s params, jd paramjd, byte paramByte)
  {
    a.d.t localt = paramjd.o();
    double d1 = localt.b();
    double d2 = localt.c();
    double d3 = localt.d() + 0.5D * d1;
    double d4 = localt.e() + 0.5D * d2;
    switch (paramByte)
    {
    case 0: 
      return new w(d3 - params.b() * 0.5D, d4 - d2 * 0.5D - this.g - params.c());
    case 1: 
      return new w(d3 - params.b() * 0.5D, d4 + d2 * 0.5D + this.g);
    case 2: 
      return new w(d3 + d1 * 0.5D + this.g, d4 - params.c() * 0.5D);
    case 3: 
      return new w(d3 - d1 * 0.5D - this.g - params.b(), d4 - params.c() * 0.5D);
    case 4: 
      return new w(d3 - params.b() * 0.5D, d4 - params.c() * 0.5D);
    }
    throw new IllegalArgumentException("Invalid position: " + paramByte);
  }
  
  public static Object a(jd paramjd, byte paramByte)
  {
    switch (paramByte)
    {
    case 0: 
    case 1: 
    case 2: 
    case 3: 
    case 4: 
      return new a_(jd.e(paramjd), paramByte);
    }
    throw new IllegalArgumentException("Invalid position: " + paramByte);
  }
  
  static boolean a(Object paramObject)
  {
    return paramObject instanceof a_;
  }
  
  public static byte b(Object paramObject)
  {
    return c(paramObject).c;
  }
  
  public static jd a(jg paramjg)
  {
    boolean bool = ld.E;
    if ((bool) || (a(paramjg.e())))
    {
      ld localld = paramjg.hb();
      if ((bool) || (localld != null)) {
        return a(localld, paramjg.e());
      }
    }
    return null;
  }
  
  public static jd a(ld paramld, Object paramObject)
  {
    return paramld.a(c(paramObject).a);
  }
  
  public static Collection a(jd paramjd)
  {
    ArrayList localArrayList = new ArrayList(1);
    ld localld = paramjd.b();
    if ((localld != null) && (localld.x() > 0))
    {
      Object localObject = localld.e(paramjd);
      int m = 0;
      int n = localld.x();
      while (m < n)
      {
        jg localjg = localld.b(m);
        if ((a(localjg.e())) && (localObject == c(localjg.e()).a)) {
          localArrayList.add(localjg);
        }
        m++;
      }
    }
    return localArrayList;
  }
  
  static boolean a(a.d.o paramo)
  {
    boolean bool = ld.E;
    if (!bool) {
      if (!Double.isNaN(paramo.d()))
      {
        if (bool) {
          break label89;
        }
        if (!Double.isNaN(paramo.e()))
        {
          if (bool) {
            break label89;
          }
          if (!Double.isNaN(paramo.g()))
          {
            if (bool) {
              break label89;
            }
            if (!Double.isNaN(paramo.h()))
            {
              if (bool) {
                break label89;
              }
              if (!Double.isNaN(paramo.i())) {
                if (bool) {
                  break label89;
                }
              }
            }
          }
        }
      }
    }
    label89:
    return Double.isNaN(paramo.j());
  }
  
  static a_ c(Object paramObject)
  {
    try
    {
      return (a_)paramObject;
    }
    catch (ClassCastException localClassCastException)
    {
      throw new IllegalArgumentException("Invalid model parameter type.");
    }
  }
  
  static Class a(String paramString)
  {
    try
    {
      return Class.forName(paramString);
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
  
  public static final class b_
    implements v, a.e.b.b.n
  {
    private static final String a = "PortLabelModel";
    private static final String b = "PortLabelModelParameter";
    public static int c;
    
    public void a(a.e.b.b.cb paramcb)
      throws a.e.b.b.a
    {
      boolean bool2 = ld.E;
      Node localNode1 = paramcb.e();
      if ((bool2) || ((localNode1.getNodeType() == 1) && ((bool2) || ("http://www.yworks.com/xml/graphml".equals(localNode1.getNamespaceURI())))))
      {
        String str = localNode1.getLocalName();
        Object localObject2;
        Object localObject3;
        Object localObject4;
        if (!bool2) {
          if ("PortLabelModel".equals(str))
          {
            double d = 0.0D;
            boolean bool1 = true;
            localObject2 = localNode1.getAttributes();
            localObject3 = ((NamedNodeMap)localObject2).getNamedItem("offset");
            if (!bool2) {
              if (localObject3 != null) {
                d = Double.parseDouble(((Node)localObject3).getNodeValue());
              }
            }
            localObject4 = ((NamedNodeMap)localObject2).getNamedItem("localCandidatesEnabled");
            if (!bool2)
            {
              if (localObject4 != null) {
                bool1 = Boolean.valueOf(((Node)localObject4).getNodeValue()).booleanValue();
              }
              paramcb.a(new ce(d, bool1));
            }
          }
        }
        if ((bool2) || ((ld.D) && ("PortLabelModelParameter".equals(str))))
        {
          NamedNodeMap localNamedNodeMap = localNode1.getAttributes();
          Node localNode2 = localNamedNodeMap.getNamedItem("id");
          Object localObject1 = null;
          if (localNode2 != null)
          {
            localObject2 = paramcb.d();
            if (!bool2) {}
            localObject3 = (fb)((a.e.b.b.t)localObject2).a(ce.i == null ? (ce.i = ce.a("a.e.b.b.fb")) : ce.i);
            if (!bool2) {}
            localObject4 = (a.e.b.b.s)((a.e.b.b.t)localObject2).a(ce.j == null ? (ce.j = ce.a("a.e.b.b.s")) : ce.j);
            a.e.b.n localn = ((a.e.b.b.s)localObject4).a((a.e.b.b.t)localObject2, (String)((fb)localObject3).get("y.io.graphml.input.CreationPropertyKeys.NODE_ID"), localNode2.getNodeValue());
            if ((bool2) || ((localn instanceof jd)))
            {
              jd localjd = (jd)localn;
              ld localld = localjd.b();
              if ((bool2) || (localld != null)) {
                localObject1 = localld.e(localjd);
              }
            }
          }
          byte b1 = 0;
          localObject3 = localNamedNodeMap.getNamedItem("position");
          if (localObject3 != null) {
            b1 = a(((Node)localObject3).getNodeValue());
          }
          paramcb.a(new ce.a_(localObject1, b1));
        }
      }
    }
    
    public void a(eb parameb)
      throws a.e.b.c.a
    {
      boolean bool = ld.E;
      Object localObject1 = parameb.a();
      Object localObject2;
      a.e.b.c.cb localcb;
      if (!bool) {
        if ((localObject1 instanceof ce))
        {
          localObject2 = (ce)localObject1;
          localcb = parameb.e();
          localcb.a("PortLabelModel", "http://www.yworks.com/xml/graphml");
          localcb.a("offset", ((ce)localObject2).b());
          localcb.a("localCandidatesEnabled", ((ce)localObject2).c());
          localcb.b();
          parameb.a(true);
        }
      }
      if ((bool) || ((ld.D) && ((bool) || (ce.a(localObject1)))))
      {
        localObject2 = ce.c(localObject1);
        localcb = parameb.e();
        localcb.a("PortLabelModelParameter", "http://www.yworks.com/xml/graphml");
        a((ce.a_)localObject2, localcb, parameb.d());
        localcb.c("position", a(((ce.a_)localObject2).c));
        localcb.b();
        parameb.a(true);
      }
    }
    
    private void a(ce.a_ parama_, a.e.b.c.cb paramcb, a.e.b.c.o paramo)
    {
      boolean bool = ld.E;
      Object localObject = paramo.a("y.io.graphml.output.SerializationProperties.CURRENT_NODE_REALIZER");
      if ((bool) || ((localObject instanceof ld)))
      {
        e locale = (e)paramo.b();
        jd localjd = ce.a((ld)localObject, parama_);
        if (localjd != null)
        {
          if (!bool) {}
          a.e.b.c.n localn = (a.e.b.c.n)paramo.a(ce.k == null ? (ce.k = ce.a("a.e.b.c.n")) : ce.k);
          String str = localn.a(localjd, locale, paramo);
          paramcb.c("id", str);
        }
      }
    }
    
    private byte a(String paramString)
    {
      boolean bool = ld.E;
      String str = paramString.toLowerCase();
      if (!bool) {
        if ("north".equals(str)) {
          return 0;
        }
      }
      if (!bool) {
        if ("south".equals(str)) {
          return 1;
        }
      }
      if (!bool) {
        if ("east".equals(str)) {
          return 2;
        }
      }
      if (!bool) {
        if ("west".equals(str)) {
          return 3;
        }
      }
      if (!bool) {
        if ("center".equals(str)) {
          return 4;
        }
      }
      try
      {
        return Byte.parseByte(paramString);
      }
      catch (NumberFormatException localNumberFormatException) {}
      return 0;
    }
    
    private String a(byte paramByte)
    {
      if (!ld.E) {
        switch (paramByte)
        {
        case 0: 
          return "north";
        case 1: 
          return "south";
        case 2: 
          return "east";
        case 3: 
          return "west";
        case 4: 
          return "center";
        }
      }
      return Byte.toString(paramByte);
    }
  }
  
  static final class a_
  {
    final Object a;
    final byte c;
    
    a_(Object paramObject, byte paramByte)
    {
      this.a = paramObject;
      this.c = paramByte;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.ce

 * JD-Core Version:    0.7.0.1

 */